package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.Movie;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 作者：Xx凯丶
 * 时间：2022/4/19 15:15
 */
@Mapper
public interface MovieSearchMapper extends BaseMapper<Movie> {
    @Select("SELECT m.movie_Id,m.movie_ch,m.movie_en,m.image,m.movie_time,m.show_time,m.show_place,m.movie_num,m.movie_status,md.content FROM\n" +
            "movie m LEFT JOIN\n" +
            "movie_desc md ON m.movie_Id = md.movie_id")
    public List<Movie> queryAllMovie();
    @Select("SELECT type_name FROM type \n" +
            "WHERE type_id in (SELECT type_id\n" +
            "FROM movie m\n" +
            "LEFT JOIN movie_type mt ON m.movie_Id = mt.movie_Id\n" +
            "WHERE m.movie_Id=#{movieId})")
    public List<String> queryTypeByMovieId(Integer movieId);
    @Select("SELECT actor_name FROM actor \n" +
            "            WHERE actor_id in (SELECT actor_id\n" +
            "            FROM movie m\n" +
            "            LEFT JOIN movie_actor ma ON m.movie_Id = ma.movie_Id\n" +
            "            WHERE m.movie_Id=#{movieId})")
    public List<String> queryAcNameByMovieId(Integer movieId);
}
